package com.ruoyi.web.controller.app.controller;

import com.ruoyi.framework.web.exception.base.XResult;
import com.ruoyi.web.controller.app.service.AppFeedBackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * @ClassName AppFeedBackController
 * @Description TODO
 * @Author tyc@yanyu
 * @Date 2018/12/12 0012 18:26
 **/
@RequestMapping("app/feedback")
@RestController
@Api(tags = "问题反馈")
public class AppFeedBackController {
    @Autowired
    private AppFeedBackService appFeedBackService;

    @RequestMapping(value = "addFeedBack",method = RequestMethod.POST)
    @ApiOperation(value = "新增问题反馈",position = 1,notes = "新增问题反馈")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "content", value = "内容", required = true, dataType = "String", paramType = "query")
    })
    public XResult addFeedBack(@RequestParam @ApiIgnore Map<String,String> map){
        return new XResult("操作成功",appFeedBackService.addFeedBack(map));
    }

    /**
     * 问题反馈列表
     * @return
     */
    @RequestMapping(value = "getList",method = RequestMethod.POST)
    @ApiOperation(value = "反馈问题列表",position = 2,notes = "反馈问题列表")
    @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query")
    public XResult getList(String memberId){
        return new XResult("操作成功",appFeedBackService.queryListById(memberId));
    }

    /**
     * 是否解决
     * @return
     */
    @RequestMapping(value = "changeStatus",method = RequestMethod.POST)
    @ApiOperation(value = "未解决",position = 3,notes = "未解决")
    @ApiImplicitParam(name = "id", value = "问题id", required = true, dataType = "String", paramType = "query")
    public XResult changeStatus(String id){
        return new XResult("操作成功",appFeedBackService.changeStatus(id));
    }

    @RequestMapping(value = "resolved",method = RequestMethod.POST)
    @ApiOperation(value = "已解决",position = 4,notes = "已解决")
    @ApiImplicitParam(name = "id", value = "问题id", required = true, dataType = "String", paramType = "query")
    public XResult resolved(String id) {
        return new XResult("操作成功", appFeedBackService.resolved(id));
    }

}
